imwayland: Fix a small leak
authorMichael Catanzaro <mcatanzaro@igalia.com>
Sun, 24 Jun 2018 20:49:46 +0000 (15:49 -0500)
committerMichael Catanzaro <mcatanzaro@igalia.com>
Sun, 24 Jun 2018 20:49:46 +0000 (15:49 -0500)
If the parent get_preedit_string implementation returns a nonnull
zero-length string, then we ignore it, which is almost fine. We have to
free it, though.

Fixes #1174

modules/input/imwayland.c

index bc710450d5a4a91764f55a0c426b7aff43fdd4d2..7e781cb9870ff111e932dc75128c174e37bcfb1c 100644 (file)
@@ -491,8 +491,13 @@ gtk_im_context_wayland_get_preedit_string (GtkIMContext   *context,
   GTK_IM_CONTEXT_CLASS (parent_class)->get_preedit_string (context, str, attrs, cursor_pos);
 
   /* If the parent implementation returns a len>0 string, go with it */
-  if (str && *str && **str)
-    return;
+  if (str && *str)
+    {
+      if (**str)
+        return;
+
+      g_free (*str);
+    }
 
   preedit_str =
     context_wayland->preedit.text ? context_wayland->preedit.text : "";